package com.huyanqi.entity;

import java.util.Calendar;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.huyanqi.core.BaseDomainObject;
import com.huyanqi.core.util.JaxbCalendarSerializer;

@Entity
@Table(name = "c_comment")
@XmlAccessorType(XmlAccessType.FIELD)
public class Comment extends BaseDomainObject {
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Id
	@Column(name="cm_id",nullable=false)
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private Long cmId;

	public void setCmId(Long cmId) {
		this.cmId = cmId;
	}
	public Long getCmId() {
		return cmId;
	}

	@Column(name="cm_content")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private String cmContent;

	public void setCmContent(String cmContent) {
		this.cmContent = cmContent;
	}
	public String getCmContent() {
		return cmContent;
	}

	@Column(name="cm_time")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	@XmlJavaTypeAdapter(JaxbCalendarSerializer.class)
	@Temporal(TemporalType.TIMESTAMP)	
	private Calendar cmTime;

	public void setCmTime(Calendar cmTime) {
		this.cmTime = cmTime;
	}
	public Calendar getCmTime() {
		return cmTime;
	}

	@Column(name="cm_sid")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private Long cmSid;

	public void setCmSid(Long cmSid) {
		this.cmSid = cmSid;
	}
	public Long getCmSid() {
		return cmSid;
	}

	@Column(name="cm_up")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private Long cmUp;

	public void setCmUp(Long cmUp) {
		this.cmUp = cmUp;
	}
	public Long getCmUp() {
		return cmUp;
	}

	@Column(name="cm_uid")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private Long cmUid;

	public void setCmUid(Long cmUid) {
		this.cmUid = cmUid;
	}
	public Long getCmUid() {
		return cmUid;
	}
	
	@Transient
	private String uHead;

	public String getuHead() {
		return uHead;
	}
	public void setuHead(String uHead) {
		this.uHead = uHead;
	}
	
	private String uNickname;
	
	public String getuNickname() {
		return uNickname;
	}
	public void setuNickname(String uNickname) {
		this.uNickname = uNickname;
	}
	public Comment() {}
	public Comment(Long cmId, String cmContent, Calendar cmTime, Long cmSid,Long cmUp, Long cmUid, String uHead,String uNickname) {
		super();
		this.cmId = cmId;
		this.cmContent = cmContent;
		this.cmTime = cmTime;
		this.cmSid = cmSid;
		this.cmUp = cmUp;
		this.cmUid = cmUid;
		this.uHead = uHead;
		this.uNickname = uNickname;
	}
	

}